@import '~assets/main.less';

.f-upload-wrap {
  @size: 120px;
  display: flex;
  flex-wrap: wrap;
  .upload-btn {
    width: @size;
    height: @size;
    text-align: center;
    border-radius: 5px;
    border: 1px dashed #ddd;
    transition: 0.2s;
    color: #999;
    cursor: pointer;
    input[type='file'] {
      display: none;
    }
    i {
      line-height: @size;
      transition: 0.2s;
      font-size: @size / 4;
    }
    &:hover {
      border-color: #bbb;
      i {
        color: @c;
        font-size: @size / 5;
      }
    }
  }

  .upload-item {
    width: @size;
    height: @size;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin: 0 10px 10px 0;
    position: relative;
    &:hover {
      .upload-item-op {
        opacity: 1;
      }
    }
    .upload-item-op {
      background-color: rgba(0, 0, 0, 0.3);
      width: 100%;
      height: 100%;
      @delHeight: 24px;
      transition: 0.2s;
      opacity: 0;
      div {
        position: absolute;
        color: #fff;
        cursor: pointer;
        transition: 0.2s;
      }
      .upload-item-op-left,
      .upload-item-op-right,
      .upload-item-op-view {
        height: calc(~'100% - @{delHeight}');
        opacity: 0.7;
        font-size: 20px;
        &:hover {
          opacity: 1;
        }
        i {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, 0);
        }
      }
      .upload-item-op-left,
      .upload-item-op-right,
      .upload-item-op-view {
        width: 20%;
      }
      .upload-item-op-left {
        left: 0;
      }
      .upload-item-op-right {
        right: 0;
      }
      .upload-item-op-view {
        width: 60%;
        left: 20%;
      }
      .upload-item-op-del {
        width: 100%;
        text-align: center;
        background: linear-gradient(
          to bottom,
          rgba(200, 0, 0, 0.4),
          rgba(200, 0, 0, 0.7)
        );
        height: @delHeight;
        line-height: @delHeight;
        left: 0;
        bottom: 0;
        &:hover {
          background: linear-gradient(
            to bottom,
            rgba(200, 0, 0, 0.45),
            rgba(200, 0, 0, 0.9)
          );
        }
      }
    }
  }

  .el-upload__input {
    display: none !important;
  }
}

.f-upload-preview {
  display: inline-block !important;
  margin: 15vh 0 0 0 !important;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  max-width: 60vw;
  min-width: 10vw;
  .el-dialog__body {
    @pad: 10px;
    padding: 30px @pad @pad @pad !important;
    text-align: center;
    .f-upload-img {
      max-width: calc(~'60vw - @{pad} * 2');
      max-height: 60vh;
    }
    .f-upload-video{
      max-width: calc(~'60vw - @{pad} * 2');
    }
  }
}

.f-upload-crop-dialog {
  .el-dialog__body {
    text-align: center !important;
  }
  .img-wrap {
    display: inline-block;
    img {
      max-width: 100%;
      max-height: 40vh;
    }
  }
  .tips {
    margin-top: 30px;
    color: #999;
  }
}
